var mult = function () {
    console.log('start');
    var a = 1;
    for (var i=0,l=arguments.length;i<l;i++){
        a = a*arguments[i];
    }
    return a;
}

// console.log(mult(2,3));
// console.log(mult(2,3,4));

var proxyMult = (function () {
   var cache = {};
    return function () {
        console.log(cache);
        var args = Array.prototype.join.call(arguments,',');
        if(args in cache){
            return cache[args];
        }
        return cache[args] = mult.apply(this,arguments);
    }
})();


console.log(proxyMult(2,3));
console.log(proxyMult(2,3,4));
console.log(proxyMult(2,3));